/* 
 * File:   Mesh.h
 * Author: brady
 *
 * Created on February 15, 2011, 11:54 AM
 */

#include "Shape.h"
#include "Triangle.h"
#include <vector>

using namespace cs5721;
using namespace std;

#ifndef MESH_H
#define	MESH_H

class Mesh : public Shape{
public:
    Mesh();
    virtual ~Mesh();
    void AddTriangle(Triangle* t);
    void AddTriangle(double x1, double y1, double z1,
                     double x2, double y2, double z2,
                     double x3, double y3, double z3);
    void AddTriangle(Vector3D p1, Vector3D p2, Vector3D p3);
    bool TestIntersect(Ray &ray, double tmin, double tmax, HitStruct& hitStruct);
//    const Vector3D SurfaceNormal(Ray &ray);
    void SetShader(Shader* shader);
    Shader* GetShader();
    double GetSortValue(int sortBy);
    void BuildBVH();

protected:
    vector<Shape*> shapes;
    Shape* hitShape;
    BoundingVolumeNode* BVHRoot;
private:

};

#endif	/* MESH_H */

